package com.yxt.dao;

import com.yxt.common.sys.CommConstant;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

public class DBOperator {
    private SQLiteDatabase database;
    private String dbfile;

	public DBOperator(Context context) {
		this(context,CommConstant.Config.DEFAULT_PHONE_DIR+CommConstant.Config.DEFAULT_DB_LOCATION);
	}
	
	public DBOperator(Context context,String dbfile) {
		this.dbfile = dbfile;
		openDatabase();	
	}
	
	private void openDatabase(){
		try	{
			database = SQLiteDatabase.openOrCreateDatabase(dbfile, null);
		}catch (Exception e){
			e.printStackTrace();
		}
	}
	
	public SQLiteDatabase getDataBase(){
		return database;
	}
	
	public void close(){
		database.close();
	}
}
